package com.qfedu.vhr.framework.exception;

import com.qfedu.vhr.common.RespBean;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;

/**
 * @author baize
 * @date 2023/1/10
 * @site www.qfedu.com
 */
@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(SQLIntegrityConstraintViolationException.class)
    public RespBean sQLIntegrityConstraintViolationException(SQLIntegrityConstraintViolationException exception) {
        return RespBean.error("有关联数据，删除失败");
    }
}
